<!-- 联动动作 -->

<template>
  <div>
    <MajorTitle title="联动动作" />

    <FormCheckbox label="联动方式" bind="action" :dict="DICT.ACTION" :hasAll="false" @change="changeAction" />

    <ActionDevice />

    <ActionVideo />

    <ActionUser />
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MyAction',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb()],

  /**
   * 组件导入 (Abc.vue + Abc/index.vue)
   */
  ...CORE.components(require.context('./', true, /vue$/)),

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 切换联动方式
     */
    changeAction(idList) {
      const { one } = this
      one.actionDevice = idList.includes(1) ? 1 : 2
      one.actionVideoPop = idList.includes(2) ? 1 : 2
      one.actionSms = idList.includes(3) ? 1 : 2
    },
  },
}
</script>
